import { useState } from "react";
import ContextTodo, {state} from "../../../../store/contextTodo";
import ContextChild1 from "./ContextChild1";
import ContextChild2 from "./ContextChild2";
import ContextChild3 from "./ContextChild3";

const ContextParent = () => {
  const [todo, setTodo] = useState(state)
    const updateList = (item) => {
      let objTodo = {...todo}
      objTodo.todoList.push(item)
      setTodo(objTodo)
    }
    return (<div>
      <ContextTodo.Provider value={{...todo, updateList}}>
        <ContextChild1 />
        <ContextChild2 />
        <ContextChild3 />
      </ContextTodo.Provider>
    </div>)
}

export default ContextParent